package main

import (
	"fmt"
	"log"
	_ "net/http/pprof"
	"os"
	"time"
)

func main() {
	initFlag()
	var tp = getType()
	log.Println(os.Getenv("version"))

	if tp == "c" { // client
		count := 0
		for {
			fmt.Println(count)
			time.Sleep(time.Second * 1)
			client(getHost(), getTPort())
			count++
		}
	} else if tp == "serverbug" {
		server(getLPort())
		fmt.Println("---serverbug---over---")
	} else if tp == "clientbug" {
		client(getHost(), getTPort())
		fmt.Println("---client---over---")
	} else if tp == "conce" {
		time.Sleep(time.Second * 1)
		client(getHost(), getTPort())
		fmt.Println("---over---")
	} else if tp == "s" { // server
		server(getLPort())
	} else if tp == "echo" {
		serverEcho(getLPort())
	} else if tp == "forward" {
		forward(getLPort(), getHost(), getTPort())
	} else if tp == "recvbig-s" {
		recvbig_s(getLPort())
	} else if tp == "recvbig-c" {
		recvbig_c(getHost(), getLPort())
	}

}
